<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Send a message to a message queue</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.msg-send" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">msg_send</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">msg_send</span> &mdash; <span class="dc-title">Send a message to a message queue</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.msg-send-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>msg_send</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$queue</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$msgtype</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$message</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$serialize</code><span class="initializer"> = <strong><code>TRUE</code></strong></span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$blocking</code><span class="initializer"> = <strong><code>TRUE</code></strong></span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$errorcode</code></span>
  ]]] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>msg_send()</strong></span> sends a <code class="parameter">message</code> of type
   <code class="parameter">msgtype</code> (which MUST be greater than 0) to
   the message queue specified by <code class="parameter">queue</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.msg-send-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">queue</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">msgtype</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">message</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">serialize</code></dt>

     <dd>

      <p class="para">
       The optional <code class="parameter">serialize</code> controls how the
       <code class="parameter">message</code> is sent.  <code class="parameter">serialize</code>
       defaults to <strong><code>TRUE</code></strong> which means that the <code class="parameter">message</code> is
       serialized using the same mechanism as the session module before being
       sent to the queue.  This allows complex arrays and objects to be sent to
       other PHP scripts, or if you are using the WDDX serializer, to any WDDX
       compatible client.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">blocking</code></dt>

     <dd>

      <p class="para">
       If the message is too large to fit in the queue, your script will wait
       until another process reads messages from the queue and frees enough
       space for your message to be sent.
       This is called blocking; you can prevent blocking by setting the
       optional <code class="parameter">blocking</code> parameter to <strong><code>FALSE</code></strong>, in which
       case <span class="function"><strong>msg_send()</strong></span> will immediately return <strong><code>FALSE</code></strong> if the
       message is too big for the queue, and set the optional
       <code class="parameter">errorcode</code> to <strong><code>MSG_EAGAIN</code></strong>,
       indicating that you should try to send your message again a little
       later on.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">errorcode</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.msg-send-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
  <p class="para">
   Upon successful completion the message queue data structure is updated as
   follows: <code class="parameter">msg_lspid</code> is set to the process-ID of the
   calling process, <code class="parameter">msg_qnum</code> is incremented by 1 and
   <code class="parameter">msg_stime</code> is set to the current time.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.msg-send-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="msg_remove_queue.html" class="function" rel="rdfs-seeAlso">msg_remove_queue()</a> - Destroy a message queue</span></li>
    <li class="member"><span class="function"><a href="msg_receive.html" class="function" rel="rdfs-seeAlso">msg_receive()</a> - Receive a message from a message queue</span></li>
    <li class="member"><span class="function"><a href="msg_stat_queue.html" class="function" rel="rdfs-seeAlso">msg_stat_queue()</a> - Returns information from the message queue data structure</span></li>
    <li class="member"><span class="function"><a href="msg_set_queue.html" class="function" rel="rdfs-seeAlso">msg_set_queue()</a> - Set information in the message queue data structure</span></li>
   </ul>
  </p>
 </div>
  

</div></div></div></body></html>